package com.shadow.baiqun.delegate.receive.pregoods;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.rey.material.app.Dialog;
import com.shadow.baiqun.R;

/**
 * @author zy
 *         on 2018/7/8
 */
public class OperationDialog extends Dialog {
    public OperationDialog(Context context, OnActionListener listener) {
        super(context);
        init(context, listener);
    }

    private void init(Context context, final OnActionListener listener) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.dialog_pre_goods_operation, null);
        setContentView(view);
        view.findViewById(R.id.btn_check_location).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onCheckLocation();
                }
            }
        });
        view.findViewById(R.id.btn_goods_back_home).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onBackHome();
                }
            }
        });
        view.findViewById(R.id.btn_order_detail).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onOrderDetail();
                }
            }
        });
    }

    public interface OnActionListener {
        void onCheckLocation();

        void onBackHome();

        void onOrderDetail();
    }
}
